package cn.jtcoding.common.framework.exception;


import cn.jtcoding.common.framework.enums.ApiResultCode;

public class ApiException extends RuntimeException {
    private static final long serialVersionUID = -4781318071924146694L;

    private ApiResultCode resultCode;

    private Object data;

    public ApiException() {
        super();
    }

    public ApiException(String message, Throwable cause) {
        super(message, cause);
    }

    public ApiException(ApiResultCode resultCode) {
        super(resultCode.getMsg());
        this.resultCode = resultCode;
    }

    public ApiException(ApiResultCode resultCode, Throwable cause) {
        super(resultCode.getMsg(), cause);
        this.resultCode = resultCode;
    }

    public ApiException(ApiResultCode resultCode, Object data) {
        super(resultCode.getMsg());
        this.resultCode = resultCode;
        this.data = data;
    }

    public ApiException(String message) {
        super(message);
    }

    public ApiResultCode getResultCode() {
        return resultCode;
    }

    public Object getData() {
        return data;
    }
}
